﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Workflows.Components.TextMining.Clustering
{
    /// <summary>
    /// term freq can be any value of {0,1,2}, 0-absence, 1-presence, 2-2 or more occurance
    /// </summary>
    public interface IDistanceCalculator
    {
        /// <summary>
        /// without weight
        /// </summary>
        /// <param name="termFreq1"></param>
        /// <param name="termFreq2"></param>
        /// <param name="contributingTerms"></param>
        /// <returns></returns>
        double CalculateDistance(
            Dictionary<int, DocTermFreq> termFreq1, 
            Dictionary<int, DocTermFreq> termFreq2, 
            ref Dictionary<int,int> contributingTerms);

        /// <summary>
        /// with weight
        /// </summary>
        /// <param name="termFreq1"></param>
        /// <param name="termFreq2"></param>
        /// <param name="termWeights"></param>
        /// <param name="useNGramSimilarity"></param>
        /// <param name="ngramLen"></param>
        /// <param name="contributingTerms"></param>
        /// <returns></returns>
        double CalculateDistance(
            Dictionary<int, DocTermFreq> termFreq1,
            Dictionary<int, DocTermFreq> termFreq2, 
            Dictionary<int, double> termWeights,
            bool useNGramSimilarity, int ngramLen,
            ref Dictionary<int, int> contributingTerms);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="termFreq1"></param>
        /// <param name="termFreq2"></param>
        /// <param name="termWeights"></param>
        /// <param name="termStemmings1">term id -> root</param>
        /// <param name="termStemmings2">root -> list of term ids</param>
        /// <param name="contributingTerms"></param>
        /// <returns></returns>
        double CalculateDistance(
            Dictionary<int, DocTermFreq> termFreq1,
            Dictionary<int, DocTermFreq> termFreq2,
            Dictionary<int, double> termWeights,
            Dictionary<int, string> termStemmings1,
            Dictionary<string, List<int>> termStemmings2,
            ref Dictionary<int, int> contributingTerms);
    }
}
